#include <rid.h>
#include <stdio.h>
#include <string.h>

#include "../rid_hex.h"

int
main(int argc, char *argv[])
{
	Rid id1;
	Rid id2;
	Rid id3;
	Rid_hex str1;
	Rid_hex str2;

	/* set both id1 to a random value */
	rid_set(id1, NULL);

	/* copy id1 into id2 */
	rid_set(id2, id1);

	/* we can also convert Rids to strings */
	rid_hex(str1, id1);
	rid_hex(str2, id2);

	/* and they will produce equal strings if they have the same value */
	if (!strcmp(str1, str2))
		printf("that only makes sense.\n");

	/* we can also get an Rid from a string */
	if (rid_hex_parse(id3, str1) < RID_HEX_LEN)
		printf("not printed since there is no error parsing.\n");

	if (!rid_cmp(id3, id1))
		printf("this will also be printed!\n");

	/* and that's all there is to it! */
	return 0;
}
